home *** CD-ROM | disk | FTP | other *** search
- // Copyright 1993 by Jon Dart. All Rights Reserved
-
- // This module handles the display of the board.
-
- #include <wpp.h>
- #include <wpgdi.h>
- #include "board.h"
- #include "search.h"
- #include <time.h>
-
- class Display
- {
- public:
-
- Display( WPWin *win, const WPRect &initial_size );
-
- ~Display();
-
- void set_size(WPRect &size);
-
- const WPRect & get_size() const
- {
- return display_area;
- }
-
- void square_rect( const Square &, WPRect & );
- // update WPRect with the boundary of the given square.
-
- void draw_board( WPDevContext &, const Board &, const WPRect *draw_Area);
- void draw_piece( WPDevContext &, const Square&, const Piece & );
- void draw_square( WPDevContext &, const Square & );
- void highlight_square( WPDevContext &, const Square & );
- void unhighlight_square( WPDevContext &, const Square & );
-
- void set_turned( Boolean turnit );
- Boolean is_turned() const
- {
- return turned;
- }
-
- Square mouse_loc( WPPoint &);
- // given where the mouse is, tell us what square it's on.
-
- void show_side( WPDevContext &, const ColorType side );
- // show side to move
-
- void show_move( WPDevContext &, const char *move_image,
- int number );
- // show last move made.
-
- void show_status( WPDevContext &, const Search::Statistics stats);
- // show status afer last move.
-
- static void show_time( HWND handle, const time_t time,
- const ColorType side );
- // show elapsed time for 'side'. This takes a handle rather than
- // a WPDevContext and is static so that it can be called from within
- // a callback fn.
-
- void clear_search_counts( WPDevContext &dc );
- // clear the "ply" and "nodes" display region.
-
- void clear_move_area( WPDevContext &dc );
- // clear the region that displays the last move.
-
- void clear_status_line( WPDevContext &dc );
- // erase the area for search messages (e.g. "Check")
-
- static void show_search_counts( HWND handle, const int ply,
- const long nodes);
- // show status during a search.
-
- private:
- void draw_piece(WPDevContext &dc,
- WPRect &square,WPBitmap *bitmap,WPRect &src_rect,
- const ColorType color, WPBitmap *outline = NULL);
- void draw_piece( WPDevContext &dc, WPRect &square, const Piece &piece);
-
- WPRect display_area;
- int square_width;
- int square_height;
- Search::Statistics current_status;
- Boolean turned;
- int width, height; // size of display area
- int vertical_border_width, horiz_border_height;
- int max_char_width, char_width, char_height;
- static int spacing;
- };
-